package cn.tedu.collection;

import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;

public class CollectionDemo4 {
    public static void main(String[] args) {
        Collection c1 = new HashSet();
        c1.add("java");
        c1.add("c");
        c1.add("c++");
        c1.add("阿弥陀佛！阿弥陀佛！");
        System.out.println("集合c1:"+c1);
        Collection c2 = new ArrayList();
        c2.add("android");
        c2.add("ios");
        c2.add("java");
        System.out.println("集合c2:"+c2);
        boolean tf = c1.addAll(c2);
        System.out.println(tf);
        System.out.println(c1);
        System.out.println(c2);
        Collection c3 = new ArrayList();
        c3.add("ios");
        c3.add("c++");
        c3.add("php");
        System.out.println(c3);
        boolean contatins = c2.containsAll(c3);
        System.out.println(contatins);
        boolean containsAll = c1.containsAll(c3);
        System.out.println(containsAll);
        c2.retainAll(c3);
        System.out.println(c2);
        System.out.println(c3);
        c1.removeAll(c3);
        System.out.println(c1);
        System.out.println(c3);

    }
}
